# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=exa
pkgver=0.10.1
pkgrel=2
pkgdesc="ls replacement written in Rust"
url="https://the.exa.website/"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le"  # limited by rust/cargo
license="MIT"
makedepends="cargo zlib-dev libgit2-dev"
subpackages="$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion"
source="$pkgname-$pkgver.tar.gz::https://github.com/ogham/exa/archive/v$pkgver.tar.gz
	https://github.com/ogham/exa/releases/download/v$pkgver/exa-accoutrements-v$pkgver.zip
	fix-lockfile.patch
	minimize-size.patch
	"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	cargo install --frozen --offline --path . --root="$pkgdir"/usr
	rm "$pkgdir"/usr/.crates*

	install -Dm644 ../man/exa.1 "$pkgdir"/usr/share/man/man1/exa.1
	install -Dm644 ../man/exa_colors.5 "$pkgdir"/usr/share/man/man5/exa_colors.5

	install -Dm644 ../completions/*.bash "$pkgdir"/usr/share/bash-completion/completions/exa
	install -Dm644 ../completions/*.fish "$pkgdir"/usr/share/fish/completions/exa.fish
	install -Dm644 ../completions/*.zsh "$pkgdir"/usr/share/zsh/site-functions/_exa
}

sha512sums="
512a6f9fbacbfcac6e3282a05852739daa85b9167eac7bb523830f47f910ceaedfdcff100a96a03e441936f84a57351b2bf0051789458c8bd21da32c9070546c  exa-0.10.1.tar.gz
4b7602d48ea9ee205f3607ed011389037eb2b8bad967579b8167df5a132c19c8ff8a5e78ebbb84e66e103e2a07a10dff3661d730569667792b92a69c632bb17c  exa-accoutrements-v0.10.1.zip
603d3b94a74000776391608409103bef5af9e4770cc35812da29cbcc0851d1b0fb70370ed2c6994af762f19285331bb11fe010102f57f9234182ae1d059c0276  fix-lockfile.patch
d1e181988a45eb9465cbd53ed0ce504672374013b6398f744f1e4a1c3d26c664cf168708b7895d1ae77c353521e8990701c1cf7e6713cccad7a884d13465bf7a  minimize-size.patch
"
